package edu.towson.cis.cosc442.project2.vendingmachine;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The unit test Class for VendingMachineItem.
 */
public class VendingMachineItemTest {

	/** Declaring necessary test objects for {@link VendingMachineItem} */
	VendingMachineItem item0, item1;

	/**
	 * Initializes the necessary test objects for the test cases to use.
	 *
	 * @throws Exception
	 *             the exception
	 */
	@Before
	public void setUp() throws Exception {
		item0 = new VendingMachineItem("Item 0", 99.0);
		item1 = new VendingMachineItem("Item 1", 100.0);
	}

	/**
	 * Test for the constructor of the {@link VendingMachineItem} class to fail
	 * if an instance is created with a price less than 0
	 */
	@Test(expected = VendingMachineException.class)
	public void testSetUpWithNegative() {
		item0 = new VendingMachineItem("Item 0", -1.0);
	}

	/**
	 * Cleans up test objects after a test case is executed.
	 */
	@After
	public void tearDown() {
		item0 = null;
		item1 = null;
	}
}
